home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 21
/
Cream of the Crop 21 (Terry Blount) (October 1996).iso
/
program
/
srcbkvt.zip
/
JAVA.ASC
< prev
next >
Wrap
Text File
|
1996-07-08
|
24KB
|
627 lines
_Visual Development Tools for Java_
by Steve V. Yalovitser
Listing One
// drdobbs.java -
// Version - 1.0
// zpb_begin Revisions
// zpb_end
import java.awt.*;
import java.util.*;
import java.applet.Applet;
import LogFontLayout; // Fixed position layout based on font size
// zpb_begin UserImports
// zpb_end
class SampleGenCodePane1 extends Canvas {
private static Applet applet;
// zpb_begin SampleGenCodePane1UserVars
// zpb_end
public SampleGenCodePane1(Applet app) {
applet = app;
// zpb_begin SampleGenCodePane1Constructor
// zpb_end
}
public void paint(Graphics g) {
Dimension d = size();
g.drawRect(0,0,d.width-1,d.height-1); // border
// zpb_begin SampleGenCodePane1Paint
// zpb_end
}
// zpb_begin SampleGenCodePane1UserMethods
// zpb_end
}
public
class drdobbs extends Applet {
private static Applet applet;
Label pStatic1;
Button pButton1;
Checkbox pRadioButton1;
CheckboxGroup pRadioButton1Group;
SampleGenCodePane1 pPane1;
// Initial size in logical units
Dimension initialSize = new Dimension(291, 172);
// zpb_begin SampleGenCodeUserVars
// zpb_end
public
void init() {
applet = this;
// zpb_begin AppletInit
// zpb_end
setBackground(Color.lightGray);
setFont(new Font("Helvetica", Font.PLAIN, 12));
LogFontLayout lfLayout = new LogFontLayout(this);
setLayout(lfLayout);
pButton1 = new Button("Button");
add("32 19 66 48", pButton1);
pStatic1 = new Label("Text");
add("133 20 22 42", pStatic1);
pRadioButton1Group = new CheckboxGroup();
pRadioButton1 = new Checkbox("Radio", pRadioButton1Group, false);
add("207 22 35 24", pRadioButton1);
pPane1 = new SampleGenCodePane1(applet);
add("74 83 79 50", pPane1);
// zpb_begin SampleGenCodeConstructor_2
// zpb_end
// Size in logical units
resize(getLayout().preferredLayoutSize(this));
// zpb_begin SampleGenCodeConstructor_3
// zpb_end
}
public Dimension minimumSize() {
// zpb_begin SampleGenCodeMinimumSize
// zpb_end
LayoutManager layoutMgr = getLayout();
if (layoutMgr instanceof LogFontLayout) {
// Convert from logical units to absolute coordinates
int w = initialSize.width;
int h = initialSize.height;
LogFontLayout layout = (LogFontLayout)layoutMgr;
return new Dimension(layout.duX(w), layout.duY(h));
}
return new Dimension(initialSize);
}
public boolean handleEvent(Event e) {
// zpb_begin SampleGenCodeHandleEvent
// zpb_end
return super.handleEvent(e);
}
public Frame getFrame(Container c) {
// zpb_begin AppletGetFrame
// zpb_end
if (c instanceof Frame || c == null)
return((Frame)c);
else
return(getFrame(c.getParent()));
}
public boolean action(Event evt, Object obj) {
if (evt.target == pButton1) {
// zpb_begin SampleGenCodeButton1Clicked
// zpb_end
}
// zpb_begin SampleGenCodeAction
// zpb_end
return true;
}
// zpb_begin SampleGenCodeAppletUserMethods
// zpb_end
}
// zpb_begin UserClasses
// zpb_end
Listing Two
/*
This class is a basic extension of the Applet class. It would generally be
used as the main class with a Java browser or the AppletViewer. But an instance
can be added to a subclass of Container. To use this applet with a browser or
the AppletViewer, create an html file with the following code:
<HTML>
<HEAD>
<TITLE>SampleGenCode window</TITLE>
</HEAD>
<BODY>
<APPLET CODE="SampleGenCode.class" WIDTH=332 HEIGHT=169></APPLET>
</BODY>
</HTML>
You can add controls to Simple with Cafe Studio.
(Menus can be added only to subclasses of Frame.)
*/
import java.awt.*;
public class SampleGenCode extends java.applet.Applet {
public void init() {
//{{INIT_CONTROLS
setLayout(null);
addNotify();
resize(insets().left + insets().right + 380, insets().top + insets().bottom + 281);
panel1=new Panel();
panel1.setLayout(null);
add(panel1);
panel1.reshape(insets().left + 49,insets().top + 128,203,75);
group1= new CheckboxGroup();
button1=new Button("Button");
add(button1);
button1.reshape(insets().left + 14,insets().top + 15,88,26);
label1=new Label("Label");
add(label1);
label1.reshape(insets().left + 126,insets().top + 15,70,105);
check1=new Checkbox("Radio button",group1, false);
add(check1);
check1.reshape(insets().left + 231,insets().top + 60,105,38);
check2=new Checkbox("Radio button",group1, false);
panel1.add(check2);
check2.reshape(42,30,105,18);
//}}
super.init();
}
public boolean handleEvent(Event event) {
return super.handleEvent(event);
}
//{{DECLARE_CONTROLS
Panel panel1;
CheckboxGroup group1;
Button button1;
Label label1;
Checkbox check1;
Checkbox check2;
//}}
}
Listing Three
import java.util.Vector;
import java.applet.Applet;
import java.awt.*;
import java.util.Hashtable;
import opusmeta.*;
import opusjava.*;
/******************************************************************************\
** **
** (C) Copyright 1996 by Autodesk, Inc. **
** **
** The information contained herein is confidential, proprietary **
** to Autodesk, Inc., and considered a trade secret as defined **
** in section 499C of the penal code of the State of California. **
** Use of this information by anyone other than authorized **
** employees of Autodesk, Inc. is granted only under a written **
** non-disclosure agreement, expressly prescribing the scope **
** and manner of such use. **
** **
\******************************************************************************/
/******************************************************************************\
** **
** This Java source file contains machine generated code which **
** will instantiate a HyperWire object network in Javaese. Because **
** the code is generated procedurally within HyperWire, it might appear **
** somewhat odd (repetitive, cryptic, etc.). **
\******************************************************************************/
final public class Hyperwire extends OpusApplet
{
Hashtable plugInMetaData = new Hashtable();
/******************************************************************************\
** **
** The following are the resetting methods. There is one method **
** for each module instance. The method is called when the **
** module is initialized and whenever the module needs to be **
** reset. These are NOT public methods. To reset a module **
** from the plug-in, or wherever, call the public **
** resetModule( Nodule aModule ) method with the module **
** you want to reset.